package com.liliudong.makabaka.stp;

import cn.dev33.satoken.stp.StpInterface;
import com.liliudong.makabaka.sys.mapper.SysMenuMapper;
import com.liliudong.makabaka.sys.mapper.SysRoleMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * sa-token 的权限处理类
 *
 * @author liudo
 * @version 1.0
 * @project makabaka-backend
 * @date 2023/9/23 22:01:58
 */
@Component
@RequiredArgsConstructor
public class StpInterfaceImpl implements StpInterface {

    private final SysMenuMapper sysMenuMapper;

    private final SysRoleMapper sysRoleMapper;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return sysMenuMapper.selectPermsListByUserId(loginId);
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return sysRoleMapper.selectRoleCodeListByUserId(loginId);
    }
}
